﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Cofe.Core.Entry;
using Cofe.Core.Interfaces;
using Cofe.Core.Property;
using Cofe.Core.Utils;

namespace Cofe.Core.Implements
{
    //[Export(typeof(ICofeService))]
    //[ServicePriority(ServicePriorityAttribute.DefaultPriority_COFE)]
    //public class CustomEntryLinkPrimaryPPRegenerator : IEntryPrimaryPPRegenerator
    //{
    //    public Task<IPropertyProvider> RegenerateAsync(IPropertyCache propertyCache)
    //    {
    //        IPropertyProvider retVal = null;
    //        if (propertyCache.IsPropertySupported(CofeEntryLinkProperties.LinkedEntryPH))
    //        {
    //            var linkedPH = propertyCache.GetOneProperty<IPropertyHost>(CofeEntryLinkProperties.LinkedEntryPH);
    //            //if (linkedPH.Behaviors.IsPropertySupported(CofeEntryListProperties.EntryListType))
    //            //{
    //            //var eListType = EnumUtils.GetEntryListType(linkedPH.Behaviors.GetProperty<string>(CofeProperties.Type));
    //            //if (eListType == EntryListTypes.CustomEntryList)
    //            //{
    //                var fullParseName = propertyCache.GetOneProperty<string>(CofeProperties.FullParseName);
    //                var fullParseNameSplit = fullParseName.Split('\\');
    //                if (fullParseNameSplit.Length != 2)
    //                    throw new Exception();

    //                CustomEntryListPropertyProvider parentEl = new CustomEntryListPropertyProvider(fullParseNameSplit[0]);


    //                retVal = new CustomEntryLinkPropertyProvider(parentEl, fullParseNameSplit[1], linkedPH);
    //            //}
    //            //}
    //            //else retVal = new CustomEntryLinkPrimaryPPRegenerator(

    //        }
    //        return Task<IPropertyProvider>.FromResult(retVal);
    //    }
    //}
}
